﻿# -*- coding:utf-8 -*-
# __auther__='jiangkai'

from selenium.webdriver.support.ui import Select
import os
from time import sleep
from extScript.UploadPic import UploadPic

class ch():
    def __init__(self):
        pass

    def test_ch(self,driver,dist=None):
        Select(driver.find_element_by_id("immovable-type")).select_by_visible_text(dist["测绘目的"])
        driver.find_element_by_name("realestateSurvey.others").clear()
        driver.find_element_by_name("realestateSurvey.others").send_keys(dist['其它'])

        driver.execute_script("arguments[0].scrollIntoView();", driver.find_element_by_name("realestateSurvey.others"))


        # driver.find_element_by_xpath('/html/body/form/content/div/div[3]/div[7]/div/div[3]/a/input').click()
        now_handle = driver.current_window_handle
        driver.find_element_by_xpath('/html/body/form/content/div/div[3]/div[7]/div/div[3]/input[2]').click()

        from extScript.ClosePrintDiag import ClosePrintDiag
        ss = ClosePrintDiag(driver=driver, mainHandle=now_handle).get_listno()

        UploadPic(driver, "/html/body/form/content/div/div[3]/div[8]/div[1]/div[3]/div[1]/div[1]/div[2]/div",
                  dist["委托申请电子照"]).upfile(
            "/html/body/form/content/div/div[3]/div[8]/div[1]/div[3]/div[1]/div[1]/div[2]/a")

        sleep(2)

        driver.execute_script("arguments[0].scrollIntoView();", driver.find_element_by_id("copy24"))
        driver.find_element_by_id("copy24").click()
        driver.find_element_by_id("end").click()

        sleep(2)

        driver.find_element_by_name("uid").click()
        driver.find_element_by_id("submitBtn").click()
        driver.find_element_by_css_selector("button[type=\"submit\"]").click()
